package mysql

import (
	"fmt"
	"sensitives/service/conf"

	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

func GetCloudConnection() (db *gorm.DB, err error) {
	db, err = gorm.Open("mysql", conf.GetCloudDataConf())
	return
}

func GetSiteConnection(site int) (db *gorm.DB, err error) {
	mysql_dsn := fmt.Sprintf(conf.GetSiteConf(), site)
	db, err = gorm.Open("mysql", mysql_dsn)
	return
}
